package com.secneo.appshare.activities;



import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.LinearLayout;

import com.secneo.appshare.AppShareApplication;
import com.secneo.appshare.R;


public class HelpWebViewActivity extends Activity{

	private WebView mWebView;
	private Button mReturnBtn;
	
	public static final String URL = "URL";
	public static final String TITLE = "TITLE";
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.sec_opt_help_webview);
		AppShareApplication.getInstance().addActivity(this);
		String url = getIntent().getStringExtra(URL);
		if(getIntent().getStringExtra(TITLE).equals(getString(R.string.help_question)))
		{
			LinearLayout header = (LinearLayout) findViewById(R.id.helpHeaderView);
			header.setVisibility(View.VISIBLE);
		}else
		{
			LinearLayout header = (LinearLayout) findViewById(R.id.helpHeaderView);
			header.setVisibility(View.GONE);
		}
		mWebView = (WebView) findViewById(R.id.help_webview);
		mReturnBtn = (Button) findViewById(R.id.returnBtn);
		mReturnBtn.setOnClickListener(mReturnListener);
		mWebView.setBackgroundColor(0);
		mWebView.loadUrl(url);
	}
	
	private final OnClickListener mReturnListener = new OnClickListener() {

		@Override
		public void onClick(View v) {
			finish();
		}
		
	};
	
	public static void go(Context context,String url,String title)
	{
		Intent i = new Intent(context, HelpWebViewActivity.class);
		i.putExtra(HelpWebViewActivity.URL, url);
		i.putExtra(HelpWebViewActivity.TITLE, title);
		context.startActivity(i);
	}
}
